home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: atk@mathcs.emory.edu (Alan Krantz)
- Newsgroups: comp.lang.c,comp.lang.c.moderated
- Subject: Can someone tell me why C can't support the following
- Date: 16 Feb 1996 09:26:29 -0600
- Organization: Emory University, Dept of Math and CS
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4g27n5$qa4@solutions.solon.com>
- NNTP-Posting-Host: solutions.solon.com
- X-Newsreader: TIN [version 1.2 PL2]
-
-
- I know the following is illegal but I would really really like to know
- why C can't support the following construct:
-
- typedef struct _mytbl {
- char *str; ; Leagal
- int *data; ; Illegal (see below)
- } mytbl[] = {"Not Defined", {0},
- "Square", {1,2,3,4,0},
- "Circle", {1,2,0},
- };
-
- Note1: I want data to point to an array of integer who's length is determined
- by a {} list. I could do something silly like "int data[10]" and assume all
- lists have 10 or fewer elements.
-
- NOTE2: I am NOT asking the compiler to generate a variable size structure
- called mytbl where data varies in size. I AM asking it to allocate a vector
- of integer and assign the address of that integer to data. Wouldn't this be
- a nice feature....
-
- Well send reasons why this is bad (and flames) to atk@cs.colorado.edu since
- I don't read the news group!
-
-
- --
- Alan Krantz
- atk@mathcs.emory.edu
- Emory University, Atlanta, GA
-